package com.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.base.BaseServiceImpl;
import com.dao.UserVoteDao;
import com.dao.VoteDao;
import com.entity.UserVote;
import com.service.UserVoteService;
import com.util.OptionRatio;
import com.util.Page;
@Service
public class UserVoteServiceImpl extends BaseServiceImpl<UserVote> implements UserVoteService {

	public UserVoteDao uvd;
	@Resource(name="userVoteDaoImpl")
	public void setUvd(UserVoteDao uvd) {
		super.setBd(uvd);
		this.uvd = uvd;
	}
	@Override
	public Page getUvByUserId(int userid,Page p) {
		return uvd.getUvByUserId(userid,p);
	}
	@Override
	public List<OptionRatio> getOptionRatio(int vid) {
		return uvd.getOptionRatio(vid);
	}
	@Override
	public void save(UserVote t) {
		t.getVote().setVturnout(t.getVote().getVturnout()+1);
		uvd.save(t);
	}
	
}
